<script type="text/javascript" src="<?=gurl('js');?>/jquery.imgareaselect.min.js"></script>
<script type="text/javascript" src="<?=gurl('js');?>/sites.js"></script>
<?php
if(strlen($large_photo_exists)>0){
?>
<script type="text/javascript">
function preview(img, selection) { 
	var scaleX = <?php echo $thumb_width;?> / selection.width; 
	var scaleY = <?php echo $thumb_height;?> / selection.height; 
	
	//$('#thumbnail + div > img').css({ 
	$('#small_file_area > img').css({ 
		width: Math.round(scaleX * <?php echo $current_large_image_width;?>) + 'px', 
		height: Math.round(scaleY * <?php echo $current_large_image_height;?>) + 'px',
		marginLeft: '-' + Math.round(scaleX * selection.x1) + 'px', 
		marginTop: '-' + Math.round(scaleY * selection.y1) + 'px' 
	});
	$('#x1').val(selection.x1);
	$('#y1').val(selection.y1);
	$('#x2').val(selection.x2);
	$('#y2').val(selection.y2);
	$('#w').val(selection.width);
	$('#h').val(selection.height);
	$('#save_thumb').attr("disabled", "");
} 

$(document).ready(function () { 
	$('#save_thumb').click(function() {
		var x1 = $('#x1').val();
		var y1 = $('#y1').val();
		var x2 = $('#x2').val();
		var y2 = $('#y2').val();
		var w = $('#w').val();
		var h = $('#h').val();
		if(x1=="" || y1=="" || x2=="" || y2=="" || w=="" || h==""){
			alert("请先选择上传图片");
			return false;
		}else{
			return true;
		}
	});
}); 

$(window).load(function () { 
	$('#thumbnail').imgAreaSelect({ aspectRatio: '1:<?php echo $thumb_height/$thumb_width;?>', onSelectChange: preview }); 
});

</script>
<?php }?>
<div class="w660">
		<div class="smallCon">
			<h1>轻站设置</h1>
			<ul class="listEdit">
				<li class="sel"><a href="<?=c('site_url');?><?=$site['domain'];?>/setting">轻站信息</a></li>
				<li onmouseover="$(this).addClass('sel');" onmouseout="$(this).removeClass('sel');"><a href="<?=c('site_url');?><?=$site['domain'];?>/setting/skin">风格设计</a></li>
				<li onmouseover="$(this).addClass('sel');" onmouseout="$(this).removeClass('sel');"><a href="<?=c('site_url');?><?=$site['domain'];?>/setting/member">成员管理</a></li>
				<li onmouseover="$(this).addClass('sel');" onmouseout="$(this).removeClass('sel');"><a href="<?=c('site_url');?><?=$site['domain'];?>/setting/ads">广告管理</a></li>
			</ul>
			<div class="hackbox"></div>
			<h3>修改轻站LOGO</h3>
			<form name="photo" enctype="multipart/form-data" action="" method="post" onSubmit="return Validator.Validate(this,2);">
			<p class="cPurple f14px">支持jpeg，gif，png格式，文件最大允许5M</p>
			<div class="upLoad"><input name="image" type="file" dataType="Require" msg="请选择图片" style="border:1px solid #CCCCCC; height:25px \0; margin-bottom:4px;"  /> <input class="smallKey" type="submit" name="upload" value="确定" /></div>
			<input type="hidden" name="dosubmit" id="dosubmit" value="1" />
			</form>
			<? if(strlen($thumb_photo_exists)>0){
				$_SESSION['random_key']= "";
				$_SESSION['user_file_ext']= "";
			} elseif(strlen($large_photo_exists)>0){?>
				<div class="imgEdit_l">
					<p>原始文件(请拉动虚线框区域控制剪裁区域)</p>
					<div id="file_area" class="imgBox">
						<? if(strlen($large_photo_exists)>0){?><img src="<?=gurl('data');?>/upload_pic/<?php echo $large_image_name.$_SESSION['user_file_ext'];?>" id="thumbnail" /><? } ?>
					</div>
				</div>
				<div id="logo_area_box_left" class="imgEdit_r">
					<p style="font-size:14px;">LOGO预览(将实际显示的LOGO图片)</p>
					<div id="small_file_area" class="imgLogo">
						<? if(strlen($large_photo_exists)>0){?><img src="<?=gurl('data');?>/upload_pic/<?php echo $large_image_name.$_SESSION['user_file_ext'];?>" alt="" /><? } ?>
					</div>
					<div id="logo_save">
						<form name="thumbnail" action="" method="post">
							<input type="hidden" name="x1" value="0" id="x1" />
							<input type="hidden" name="y1" value="0" id="y1" />
							<input type="hidden" name="x2" value="60" id="x2" />
							<input type="hidden" name="y2" value="60" id="y2" />
							<input type="hidden" name="w" value="60" id="w" />
							<input type="hidden" name="h" value="60" id="h" />
							<input type="hidden" name="dosubmit2" id="dosubmit2" value="1" />						
					</div>
					<p style="height:30px"><input name="upload_thumbnail" id="save_thumb" class="smallKey" onclick="aj_save_sitelogo(<?=$site['id'];?>);" type="button" value="保存" /> <em id="save_msg2" class="cDGreen">&nbsp;</em></p>
					</form>
				</div>
				
			<? } ?>
			<div class="hackbox"></div>
			<h3>修改轻站信息</h3>
			<form name="descform" id="descform" action="" method="post">
			<ul class="listInfo" style="margin-top:20px;">
				<li><label>轻站描述：</label><div><input id="description" name="description" value="<?=$site['info']['description'];?>" maxlength="40" type="text" class="hotwebName" /><p class="cCGray">写出你的轻站精神、口号、用途，最多20个字</p></div></li>
				<li><label>轻站分类：</label><div><select name="topclass" id="topclass" onChange="aj_change_class(this.value)">
					 <option value="">请选择</option>
					<? foreach($topclass as $class):?>
						<option value="<?=$class['id'];?>" <? if($class['id'] == $currentclass['parentid']):?> selected <? endif;?> ><?=$class['name'];?></option>
					<? endforeach;?>
				</select> <select name="subclass" id="subclass">
				  		<option value="">请选择</option>
						<? foreach($subclass as $class):?>
							<option value="<?=$class['id'];?>" <? if($class['id'] == $currentclass['id']):?> selected <? endif;?>><?=$class['name'];?></option>
						<? endforeach;?>
				</select><span id="class_msg" style="color:#FF0000;"></span></div></li>
				<li><label>轻站标签：</label>
				<div>
					<? foreach ($tags as $tag):?><span><input name="tag" id="tag" type="checkbox" <? if(in_array($tag['id'], $tagslist)):?> checked <? endif;?> value="<?=$tag['id'];?>" /><?=$tag['tagname'];?></span><? endforeach;?>
					<p class="cCGray" id="tag_msg">&nbsp;</p>
				</div></li>
			</ul>
			<div class="hackbox"></div>
			<p style="height:30px">
				<input type="button" value="保存" class="smallKey" onclick="aj_save_sitedesc();"> <em id="save_msg" class="cDGreen">&nbsp;</em>
			</p>
			<input type="hidden" name="dosubmit3" id="dosubmit3" value="1" /><br />
			<input type="hidden" name="siteid" id="siteid" value="<?=$site['id'];?>" />
			</form>
		</div>
	</div>
		<div class="smallTip">
			<h3>提醒</h3>
			<ul>
				<li>1. 商业使用(品牌、名人、公司)可申请认证，<a href="<?=gurl('about/contact');?>" >联系热闹网客服</a>。</li>
				<li>2. 遇到恶意成员，<a href="<?=gurl('about/ad');?>" >联系热闹网举报</a>。</li>
			</ul>
		</div>
	<div class="hackbox"></div>
</div>

